function serverbe
{
	cd ..
	mkdir server
	cd ./server
	wget -O server.zip https://minecraft.azureedge.net/bin-linux/bedrock-server-1.19.51.01.zip
	unzip -d ./ server.zip
	cd ..
	cd ./cd
}

function java
{
	cd ..
	wget -O java.tar.gz https://download.oracle.com/java/17/archive/jdk-17.0.6_linux-x64_bin.tar.gz
	tar -zxvf java.tar.gz
	mv jdk-17.0.6 java
	cd ./cd
}

function becd
{
	chmod +x ./minecraft/be.sh
	bash ./minecraft/be.sh
}

function javacd
{
	chmod +x ./minecraft/java.sh
	bash ./minecraft/java.sh
}


function openbe
{
	clear
	cd ../server
	chmod +x ./bedrock_server
  ./bedrock_server
	cd ../cd
}

function dfrp
{
	cd ..
	mkdir frp
	cd ./frp
	wget https://d.starryfrp.com/c/frpc_linux_amd64/frpc
	touch frpc.ini
	cd ..
	cd ./cd
}

function eula
{
	cd ..
	nano ./server/eula.txt
	cd ./cd
}

function mozu
{
	 chmod +x ./minecraft/mz.sh
	 ./minecraft/mz.sh
}

function serverjava
{
	cd ..
	mkdir server
	cd ./server
	echo -e "内核下载较慢，请耐心等待"
	wget -O server.jar https://piston-data.mojang.com/v1/objects/c9df48efed58511cdd0213c56b9013a7b5c9ac1f/server.jar
	cd ../cd
}

function openjava
{
	clear
	cd ../server
	chmod +x '../java/bin/java'
	'../java/bin/java' -jar './server.jar'
	echo -e "如果自动退出，请到菜单内快捷修改eula文件"
	cd ../cd
}

function menu1
{
	clear
	echo -e "\t\t\t\t\t\t ༺ཌༀൢ༒ൢༀད༻"
	echo -e "\t\t\t\t\t\t 开服菜单"
	echo -e "\t\t\t1. 下载我的世界服务器内核（基岩版）1.19.51"
	echo -e "\t\t\t2. 打开基岩版服务器"
	echo -e "\t\t\t3. 下载frp工具"
	echo -e "\t\t\t4. 下载java17"
	echo -e "\t\t\t5. 下载我的世界服务器内核（java）1.19.3"
	echo -e "\t\t\t6. 打开java版服务器"
	echo -e "\t\t\t7. 快捷修改eula"
	echo -e "\t\t\t8. java版高级菜单"
	echo -e "\t\t\t9. 基岩版高级菜单"
	echo -e "\t\t\tm. 安装常用spigot插件"
	echo -e "\t\t\t0. 返回主菜单\n\n"
	echo -e "                                                                                  ——bilibili北门の老登"
	echo -en "\t\t输入对应的数字:"
	read -n 1 option
}

while [ 1 ]
do
	menu1
	case $option in
	0)
    break ;;
	1)
    serverbe ;;
	2)
		openbe ;;
	3)
		dfrp ;;
	4)
		java ;;
	5)
		serverjava ;;
	6)
		openjava ;;
	7)
		eula ;;
	8)
		javacd ;;
	9)
		becd ;;
	m)
		mozu ;;
	*)
		clear
		echo "你输入错了！请重试" ;;
	esac
	echo -en "\n\n\t按任意键继续"
	read -n 1 line
done
clear
